package com.frogs.ucenter.v1.request;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.util.StringUtil;
import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.util.ApplicablePlatformEnum;
import com.frogs.system.util.HonorRefEnum;
import com.frogs.system.util.HonorTypeEnum;
import com.frogs.system.util.PromotionApplicablePlatformEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;


public class QEAddRequest extends Request {
	

	/**
	 * 
	 */
	private static final long serialVersionUID = 190545081906174219L;
	private Integer userId;
	private String openId;
	private String wechatAccount;
	private Integer dataTypeId = 0;
	private String content;

	
	public QEAddRequest(){
		
	}

	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		this.openId = requestInfo.getParameter(ApiUrlParamEnum.openId.getParamName(),null);
		this.wechatAccount = requestInfo.getParameter(ApiUrlParamEnum.nickName.getParamName(),null);
		this.dataTypeId = requestInfo.getIntParameter(ApiUrlParamEnum.equipmentTypeId.getParamName(),-1);
		this.content = requestInfo.getParameter(ApiUrlParamEnum.questionContent.getParamName(),null);

		if(userId == 0 ) {
			throw new RequestIllegalException("传递错误的参数，请确认userId不能为空!");
		}

		if(openId == null) {
			throw new RequestIllegalException("传递错误的参数，请确认openId不能为空!");
		}
		if(wechatAccount == null) {
			throw new RequestIllegalException("传递错误的参数，请确认wechatAccount不能为空!");
		}
		
		if(dataTypeId < 0 ) {
			throw new RequestIllegalException("传递错误的参数，请确认dataTypeId不能为空!");
		}
		if(content == null) {
			throw new RequestIllegalException("传递错误的参数，请确认content不能为空!");
		}
		
	}


	public Integer getUserId() {
		return userId;
	}


	public void setUserId(Integer userId) {
		this.userId = userId;
	}


	public String getOpenId() {
		return openId;
	}


	public void setOpenId(String openId) {
		this.openId = openId;
	}


	public String getWechatAccount() {
		return wechatAccount;
	}


	public void setWechatAccount(String wechatAccount) {
		this.wechatAccount = wechatAccount;
	}


	public Integer getDataTypeId() {
		return dataTypeId;
	}


	public void setDataTypeId(Integer dataTypeId) {
		this.dataTypeId = dataTypeId;
	}


	public String getContent() {
		return content;
	}


	public void setContent(String content) {
		this.content = content;
	}
	
		
	}
	
	
